<?php

namespace app\api\validate;

use think\Validate;

class User extends Validate
{
    protected $rule = [
        ['longitude',      'require',               '未获取到当前经度'],
        ['latitude',       'require',               '未获取到当前纬度'],
        ['page',           'number|>=:0',           '当前页出错|当前页出错'],
        ['pagesize',       'number|>:0',            '分页出错|分页出错'],
        ['user_id',        'require|number|>:0',    '用户不存在|用户不存在|用户不存在'],
        ['to_user',        'require|number|>:0',    '用户不存在|用户不存在|用户不存在'],
        ['head',           'require',               '请先上传头像'],
        ['password',       'require|alphaDash|length:6,16',               '请先填写密码|密码只能为字母和数字，下划线_及破折号-|密码长度在6-16之间'],
        ['state',          'require|number|in:0,1', '登陆状态出错|登陆状态出错|登陆状态出错'],
        ['content',        'require',               '内容不能为空'],
        ['types',          'number|in:1,2',         '类型有误|类型有误'],
        ['name',           'chsDash|max:10',         '只能汉字、字母、数字|长度不能超过6个字符'],
        ['code',           'number',                '验证码错误'],
        ['invite_code',    'require|alphaDash|length:7',        '邀请码错误|邀请码错误|邀请码错误'],
        ['paypwd',         'number|length:6',        '提现密码为6位数字|提现密码为6位数字'],
    ];

    protected $scene = [
        'index'             => ['longitude', 'latitude', 'name'],
        'info'              => ['user_id', 'longitude', 'latitude'],
        'addBlackList'      => ['to_user'],
        'attention'         => ['to_user'],
        'changeHead'        => ['head'],
        'changePwd'         => ['password'],
        'setOnline'         => ['state'],
        'feedback'          => ['content'],
        'likeAvatar'        => ['user_id', 'to_user'],
        'defend'            => ['page', 'types'],
        'myGrade'           => ['types'],
        'createTag'         => ['name'],
        'editPwd'           => ['code', 'password'],
        'editInfo'          => ['code', 'paypwd'],
        'bindInvite'        => ['invite_code'],
        'checkFate'         => ['user_id'],
    ];
}

